#-*-coding: utf-8 -*-
#/usr/bin/python

import ssh5

def add_member(member_name):
    host = raw_input("host: ")
    port = raw_input("port: ")
    username = raw_input("username: ")
    password = raw_input("password: ")
    cmd = raw_input("command: ")
    dict2 = {"host": host, "username": username, "port": port, "password": password, "cmd": cmd}
    f = open("/root/member.txt", "a")
    for k,v in dict2.items():
        f.write(k + ": " + v + "\n")
    f.write("\n")
#    f.write("host: " + dict2["host"] + "\n")
#    f.write("port: " + dict2["port"] + "\n")
    f.close()
    ssh5.ssh5(dict2["host"], int(dict2["port"]), dict2["username"], dict2["password"], dict2["cmd"])

dict_count = 0
while True:
    dict_count = dict_count + 1
    member =  "dict" + str(dict_count)
    print member
    add_member(member)
    status = raw_input("type any key for continue, type 'quit' for exit: ")
    if status == "quit":
        print "Bye..."
        break
